import request from '@/utils/request'

export function getRoutes() {
  return request({
    url: '/vue-element-admin/routes',
    method: 'get'
  })
}

export function getRoles() {
  return request({
    url: '/vue-element-admin/role',
    method: 'get'
  })
}

export function addRole() {
  return request({
    url: '/vue-element-admin/role',
    method: 'get'
  })
}

// 新增角色
export const createRole = (data) => request({
  url: '/admin/role',
  method: 'post',
  data
})

// 删除角色
export const deleteRole = (data) => request({
  url: '/admin/role',
  method: 'delete',
  data
})

// 修改角色
export const updateRole = (data) => request({
  url: '/admin/role',
  method: 'put',
  data
})

// 单个查询角色
export const queryRole = (id) => request({
  url: '/admin/role',
  method: 'get',
  params: { id }
})

// 分页查询角色
export const pageQuery = (data) => request({
  url: '/admin/role/page',
  method: 'post',
  data
})
